<template>
  <el-table
    :data="tableData.filter(data => !search || data.name.toLowerCase().includes(search.toLowerCase()))"
    style="width: 100%">
    <el-table-column label="店铺名称" prop="name">
    </el-table-column>
    <el-table-column  label="地址"  prop="address">
    </el-table-column>
    <el-table-column  label="电话"  prop="tel">
    </el-table-column>
    <el-table-column  label="店铺描述"  prop="information">
    </el-table-column>
    <el-table-column align="right">
             <template slot="header" slot-scope="scope">
        <el-input
          v-model="search"
          size="mini"
          placeholder="输入关键字搜索"/>
      </template>
      <template>
        <el-button
          size="mini"
          @click="updateShops">修改</el-button>
        <el-button
          size="mini"
          type="danger"
          @click="deleteShops">注销门店</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>
<script>
 import { createNamespacedHelpers} from 'vuex'
 const {mapState,mapActions} = createNamespacedHelpers("shopsStore")
  export default {
    data(){
          return {
            search: ''
          }
    },
    computed:{
      ...mapState(["tableData"])
    },
    methods:{
      ...mapActions(["updateShops","deleteShops"])
    }
  }
</script>

<style>

</style>